#!/usr/bin/python3
# -*- coding: utf-8 -*-

def query_string(request):
    params = {}
    for item in request.query_string.split('&'):
        if '=' in item:
            k, v = item.split('=')
            params[k] = v.strip().replace('%3B', ';').replace('%3D', '=')
    return params

async def post_params(request):
    kw = {}
    content_type = request.content_type.lower()
    if content_type.startswith('application/json'):
        return await request.json()
    elif content_type.startswith('application/x-www-form-urlencoded') or content_type.startswith('multipart/form-data'):
        params = await request.post()
        return dict(**params)
    else:
        return kw
    return kw